package com.stox.client.ui.core.application;

import com.stox.client.ui.javafx.chartingy.persistence.chart.application.SavedChartApplication;
import com.stox.client.ui.javafx.navigator.application.NavigatorApplication;
import com.stox.client.ui.javafx.screener.application.ScreenerApplication;
import com.stox.client.ui.javafx.watchlist.application.WatchlistApplication;

public interface Application {
	
	public static final Application[] ALL = {
		NavigatorApplication.INSTANCE, 
		WatchlistApplication.INSTANCE, 
		ScreenerApplication.INSTANCE,
		SavedChartApplication.INSTANCE};

	public static enum Status{
		DORMANT,
		REGISTERED,
		STARTED,
		SHOWING;
	}
	
	public Status getStatus();
	
	/**
	 * This is the first method called on any application
	 * 
	 * This method will be invoked at the time of startup,
	 * thus application should only register it's presence;
	 * should not start the application
	 */
	public void register();
	
	/**
	 * @return Should return locale specific name of the application
	 */
	public String getName();
	
	/**
	 * Starts the application
	 * Any non-visible components of the application should be fired up
	 * No visible components should be shown
	 * Application must be registered before calling this method
	 */
	public void start();
	
	/**
	 * Show the application UI
	 * Application must be started before calling this method
	 */
	public void show();
	
	public void hide();
	
	/**
	 * Stops the application
	 * If any application components are showing, they must be hidden first
	 * Any resources like timer should be stopped
	 */
	public void stop();
	
	public void unregister();
	
}
